<?php

namespace App\Http\Requests;


class MessRequest
{
    /**
     * 对传入的数据 添加验证规则
     * present  验证字段必须出现在输入数据中、能为空
     * filled   验证字段可不在输入数据中 当验证字段出现在输入数据中时，不能为空
     */

    public function create()
    {
        $rules = [
            "patient_id" => 'filled|int',
            "event_id" => 'required|int|max:50',
            "name" => 'sometimes|max:255',
            "age" => 'present|max:150',
            "gender" => 'present|max:3',
            "card" => 'present|max:20',
            "province" => 'nullable|string|max:50',
            "city" => 'nullable|string|max:50',
            "area" => 'nullable|string|max:50',
            "address" => 'present|max:500',
            "initial_diagnosis" => 'present|max:500'
        ];

        $rName = [
            "patient_id" => '患者ID',
            "event_id" => '事件ID',
            "name" => '姓名',
            "age" => '年龄',
            "gender" => '性别',
            "card" => '身份证号',
            "province" => '省份',
            "city" => '城市',
            "area" => '地区',
            "address" => '详细地址',
            "initial_diagnosis" => '初步诊断'
        ];

        $data['rules'] = $rules;
        $data['rName'] = $rName;
        return $data;
    }

    public function oneString()
    {
        $rules = [
            "name" => 'required|string|max:500',
        ];

        $rName = [
            "name" => '名称'
        ];

        $data['rules'] = $rules;
        $data['rName'] = $rName;
        return $data;
    }

    public function getCity()
    {
        $rules = [
            "province_id" => 'required|int',
        ];

        $rName = [
            "province_id" => '省份ID'
        ];

        $data['rules'] = $rules;
        $data['rName'] = $rName;
        return $data;
    }

    public function getArea()
    {
        $rules = [
            "city_id" => 'required|int',
        ];

        $rName = [
            "city_id" => '城市ID'
        ];

        $data['rules'] = $rules;
        $data['rName'] = $rName;
        return $data;
    }
//
//    public function idCodeocr()
//    {
//        $rules = [
//            "img" => 'image'
//        ];
//
//        $rName = [
//            "file" => '上传文件'
//        ];
//
//        $data['rules'] = $rules;
//        $data['rName'] = $rName;
//        return $data;
//    }

    public function patientId()
    {
        $rules = [
            "patient_id" => 'required|int',
        ];

        $rName = [
            "patient_id" => '患者ID'
        ];

        $data['rules'] = $rules;
        $data['rName'] = $rName;
        return $data;
    }

    public function saveOne()
    {
        $rules = [
            "patient_id" => 'required|int',
            "f_walk" => 'nullable|int',
            "f_breath" => 'nullable|int',
            "f_open_breath" => 'nullable|int',
            "f_breath_num" => 'nullable|int',
            "f_blood" => 'nullable|int',
            "f_advice" => 'nullable|int',

        ];

        $rName = [
            "patient_id" => '患者ID',
            "f_walk" => '是否能走动',
            "f_breath" => '是否呼吸',
            "f_open_breath" => '开放气道后是否可以自主呼吸',
            "f_breath_num" => '呼吸次数',
            "f_blood" => '血管',
            "f_advice" => '遵嘱',
        ];

        $data['rules'] = $rules;
        $data['rName'] = $rName;
        return $data;
    }

    public function saveTwoTrait()
    {
        $rules = [
            "patient_id" => 'required|int',
            "injury_site" => 'nullable|max:255',
            "accident_type" => 'nullable|max:255',
            "damage_type" => 'nullable|max:255'
        ];

        $rName = [
            "patient_id" => '患者ID',
            "injury_site" => '受伤部位',
            "accident_type" => '事故类型',
            "damage_type" => '损伤类型'
        ];

        $data['rules'] = $rules;
        $data['rName'] = $rName;
        return $data;
    }

    public function saveTwoSceneB()
    {
        $rules = [
            "patient_id" => 'required|int',
            "type" => 'required|int',
            "injury_time" => 'nullable|max:255',
            "tt" => 'nullable|string|max:255',
            "pp" => 'nullable|int|max:255',
            "rr" => 'nullable|int|max:255',
            "bp_a" => 'nullable|int|max:255',
            "bp_b" => 'nullable|int|max:255',
            "eye" => 'nullable|max:255',
            "lang" => 'nullable|max:255',
            "sport" => 'nullable|max:255',
            "for_status" => 'nullable|max:255',
            "nerve" => 'nullable|max:255',
            "breathe" => 'nullable|max:255'
        ];

        $rName = [
            "patient_id" => '患者ID',
            "type" => '检伤类型',
            "injury_time" => '检伤时间',
            "tt" => '体温',
            "pp" => '脉搏频次',
            "rr" => '呼吸频次',
            "bp_a" => '收缩压',
            "bp_b" => '舒张压',
            "eye" => '睁眼反应',
            "lang" => '语言反应',
            "sport" => '运动反应',
            "for_status" => '循环状态',
            "nerve" => '神经系统',
            "breathe" => '呼吸状态'
        ];

        $data['rules'] = $rules;
        $data['rName'] = $rName;
        return $data;
    }

    public function setLevelMess()
    {
        $rules = [
            "patient_id" => 'required|int',
            "level" => 'required|int',
        ];

        $rName = [
            "patient_id" => '患者ID',
            "level" => '病情判断',
        ];

        $data['rules'] = $rules;
        $data['rName'] = $rName;
        return $data;
    }

    public function saveIssData()
    {
        $rules = [
            "patient_id" => 'required|int',
            "iss_count" => 'required|int',
            "ais_count" => 'required|int',
        ];

        $rName = [
            "patient_id" => '患者ID',
            "iss_count" => 'iss分值',
            "ais_count" => 'ais分值',
        ];

        $data['rules'] = $rules;
        $data['rName'] = $rName;
        return $data;
    }
}
